package com.rc.saas.mini.service.tenant;

import com.rc.saas.mini.mapper.tenant.TenantPaymentMapper;
import com.rc.saas.mini.model.tenant.TenantPayment;
import com.rc.saas.mini.model.tenant.TenantPaymentExample;
import com.rc.saas.mini.service.tenant.TenantPaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TenantPaymentServiceImpl implements TenantPaymentService {
    @Autowired
    private TenantPaymentMapper tenantPaymentMapper;

    @Override
    public TenantPaymentMapper getMapper() {
        return tenantPaymentMapper;
    }

    @Override
    public TenantPayment selectByTenantCodeAndPaymentType(String tenantCode, String paymentType) {
        TenantPaymentExample example=new TenantPaymentExample();
        example.createCriteria().andTenantCodeEqualTo(tenantCode).andPaymentTypeEqualTo(paymentType).andOpenMinichannelEqualTo("0");
        return tenantPaymentMapper.selectByExample(example).stream().findFirst().orElseGet(()->null);
    }
}
